<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./libs/vue3.js"></script>
    <style>
        .home{
            background: #EEE;
            padding: 10px;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 调用全局组件 -->
        <home></home>
    </div>
</body>
<script>
    // 创建应用实例
    const app=Vue.createApp({
        data(){
            return {}
        },
        methods:{

        }
    });
    // 注册全局组件
    app.component('home',{
        template:`
            <div class="home">
                <h1>{{title}}</h1>  
                <button @click="updateTitle">update title</button>  
            </div>
        `,
        data(){
            return {
                title:'全局组件home'
            }
        },
        methods:{
            updateTitle(){
                this.title='new title';
            }
        }
    })

    // 挂载应用实例
    app.mount('#app');
</script>
</html>